<!--
@license
Copyright 2024 The Model Explorer Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================
-->

<div class="container"
    matTooltip="Style nodes with custom data">
  <div class="icon-container"
      [bubbleClick]="dropdown"
      [overlaySize]="dropdownSize">
    @if (remoteSourceLoading() || hasExtensionRunning()) {
      <mat-spinner color="primary" diameter="18">
      </mat-spinner>
    } @else {
      <mat-icon>add_circle_outline</mat-icon>
    }
    <span class="label">Add per-node data</span>
  </div>
</div>

<ng-template #dropdown>
  <div class="model-explorer-node-data-provider-dropdown">
    <div class="section-label upload">
      <div>Load json data file</div>
      <a href="https://github.com/google-ai-edge/model-explorer/wiki/2.-User-Guide#custom-node-data"
         target="_blank">
         Guide
      </a>
    </div>
    <div class="upload-container">
      <div class="description">From computer</div>
      <button class="upload-json-file-button upload"
          mat-flat-button color="primary"
          (click)="input.click()">
        Upload
      </button>
    </div>
    <input class="upload-per-node-data-input"
        type="file" #input
        multiple
        accept=".json"
        (change)="handleClickUpload(input)">

    <div class="section-label extensions">
      <div>Extensions</div>
      <a href="https://github.com/google-ai-edge/model-explorer/wiki/"
        target="_blank">
        Guide
      </a>
    </div>
    <ndp-extensions-panel (onOpenNdpExtensionDialogClicked)="handleOpenNdpExtensionDialogClicked($event)">
    </ndp-extensions-panel>
  </div>
</ng-template>
